<?php
/**
 * This is LilAds helper. 
 *
 * @copyright     Copyright 2008-2010, LilCake.net
 * @link          http://lilcake.net LilCake.net
 * @package       lil_ads
 * @subpackage    lil_ads.views.helpers
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
/**
 * LilAdsHelper class
 *
 * @uses          Helper
 * @package       lil_ads
 * @subpackage    lil_ads.views.helpers
 */
class LilAdsHelper extends AppHelper {
/**
 * helpers property
 *
 * @var array
 * @access public
 */
	var $helpers = array('Html');
/**
 * location method
 *
 * Displays location by Id
 *
 * @param int $id
 * @access public
 * @return mixed
 */
	function location($location_id) {
		// todo: calling helper method should display lilads location
    	if (!is_numeric($location_id)) return false;
    	
    	$View =& ClassRegistry::getObject('view'); 
    	
    	if (Configure::read('LilAds.active') && ($BannerModel = ClassRegistry::init('LilAds.AdsBanner'))) {
    		$banner = $BannerModel->findForLocation($location_id);
			$View->set(compact('banner'));
		}
		
		return $View->element('location_show', array('plugin' => 'lil_ads')); 
	}
}
?>